<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
  	  	function on_role_mod(index){
  	  	 var rows = $('#role_table').datagrid('getRows');
  	  	 var roleno = rows[index].roleno;
  	  	 $('#mod_role_win').window('open');
  	  	 $('#roleno').val(roleno);
  	  	 $('#roleno_val').val(roleno);
  	  	 $('#rolename').val(rows[index].rolename);
  	  	 $('#typeid').combobox('setValue',rows[index].depttype);
  	  	 
  	  	 reset_menu_items('#menutree');
  	  	 var a=rows[index].checkedItems;
  	  	 for(m=0;m<a.length;m++){
  	  	   var b=a[m].items;
  	  	   for(n=0;n<b.length;n++){
  	  	     var c=$('#menutree').tree('find',b[n]);
  	  	     if (c!=null){$('#menutree').tree('check', c.target);}
  	  	   }
  	  	 }
        }
        
    	function on_node_mod_ui(value,row,index){
          return '<a href="#" class="edtclass" onclick="on_role_mod(\''+index+'\')">修改</a>';
        }
        
        function on_doc_ready()
	  	{
         $('#mod_role_panel').panel({onOpen:function(){
	    	var fields = [
	      		{field:'roleno',title:'角色号',width:80,align:'center'},
	      		{field:'rolename',title:'角色名称',width:150,align:'center'},
	        	{field:'depttypename',title:'所属机构类型',width:80,align:'center'},
	      		{field:'action',title:'修改',width:80,align:'center',formatter:on_node_mod_ui}
	    	];
	    
	    	$('#role_table').datagrid({url:'queryRoleInfo.action',pageSize:13,pageList:[13],
	    		columns:[fields],pagination:false,striped:true});
	    	}});	    
	     }

        
    	$(document).ready(function(){
   		  on_doc_ready();
    	});
    </script>
	</head>
	<body>
	<s:include value="modroledetail.jsp"></s:include>
    <div id="mod_role_panel" collapsible="false" fit="true" title="修改角色" 
    	resizable="false" collapsible="false" minimizable="false" maximizable="false" 
    	closable="true" icon="icon-save" class="jquery_panel">
    	<table width="100%" height="100%">
    		<tr>
    			<td>
    				<table id="role_table" title="管理员角色表" singleSelect="true" fit="true"
						fitColumns="true" style="background-color:white;"></table>
 				</td>
    		</tr>
    	</table>
    </div>
    
    </body>
</html>